package ofc4j.util;

import ofc4j.model.elements.ScatterChart;
import ofc4j.model.elements.ScatterChart.Point;

import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.io.path.PathTrackingWriter;

public class ScatterChartPointConverter extends ConverterBase<Point> {
    @Override
    @SuppressWarnings("unchecked")
    public boolean canConvert(Class c) {
        return ScatterChart.Point.class.isAssignableFrom(c);
    }

    @Override
    public void convert(Point o, PathTrackingWriter writer, MarshallingContext mc) {
        writeNode(writer, "x", o.getX());
        writeNode(writer, "y", o.getY());
    }
}
